package org.mspring.mlog.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

/**
 * 新闻扩展字段
 * 
 * @author Gao Youbo
 * @since 2013年7月9日
 */
@Entity
@Table(name = "news_ext")
public class NewsExt implements Serializable {

    private static final long serialVersionUID = -8596521193566414317L;

    private Long newsId;
    private News news;
    private Long views;
    private Long comments;

    public NewsExt() {
    }

    public NewsExt(Long newsId, Long views, Long comments) {
        super();
        this.newsId = newsId;
        this.views = views;
        this.comments = comments;
    }

    @Id
    @Column(name = "news_id", unique = true, nullable = false)
    public Long getNewsId() {
        return newsId;
    }

    public void setNewsId(Long newsId) {
        this.newsId = newsId;
    }

    @OneToOne(fetch = FetchType.LAZY, optional = false)
    @PrimaryKeyJoinColumn
    public News getNews() {
        return news;
    }

    public void setNews(News news) {
        this.news = news;
    }

    @Column(name = "views", length = 30)
    public Long getViews() {
        return views;
    }

    public void setViews(Long views) {
        this.views = views;
    }

    @Column(name = "comments", length = 30)
    public Long getComments() {
        return comments;
    }

    public void setComments(Long comments) {
        this.comments = comments;
    }

}
